package com.ruoyi.waterManagement.controller;

import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.business.BusinessUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.waterManagement.domain.vo.DataQualityVO;
import com.ruoyi.waterManagement.domain.vo.WaterRegimeMonitoringVO;
import com.ruoyi.waterManagement.service.IDataQualityService;
import com.ruoyi.waterManagement.service.IWaterRegimeMonitoringService;
import com.ruoyi.waterManagement.service.IWrStatvolHService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 完整率
 *
 * @author hwd
 * @date 2023-02-16
 */
@RestController
@RequestMapping("/DataQuality")
public class DataQualityController extends BaseController
{

    @Autowired
    private IDataQualityService dataQualityService;


    /**
     * 显示各监测站的数据完整率及逐级汇总数据
     * 数据权限过滤
     */
    @ApiOperation("显示各监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listStationDataWzl")
    public TableDataInfo listStationDataWzl(DataQualityVO dataQualityVO) throws ParseException {
        dataQualityVO.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listStationDataWzl(dataQualityVO);
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setRows(voList);
        rspData.setMsg("查询成功");
        return rspData;
    }

    /**
     * 显示年月各监测站的数据完整率及逐级汇总数据
     */
    @ApiOperation("显示年月各监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listStationDataWzlGroupYM")
    public AjaxResult listStationDataWzlGroupYM(DataQualityVO dataQualityVOGroupYM) throws ParseException {
        dataQualityVOGroupYM.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listStationDataWzlGroupYM(dataQualityVOGroupYM);
        return  AjaxResult.success(voList);
    }

    /**
     * 显示月日各监测站的数据完整率及逐级汇总数据
     */
    @ApiOperation("显示月日各图片监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listStationDataWzlGroupMD")
    public AjaxResult listStationDataWzlGroupMD(DataQualityVO dataQualityVOGroupMD) throws ParseException {
        dataQualityVOGroupMD.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listStationDataWzlGroupMD(dataQualityVOGroupMD);
        return  AjaxResult.success(voList);
    }


    /**
     * 显示各图片监测站的数据完整率及逐级汇总数据
     * 数据权限过滤
     */
    @ApiOperation("显示各图片监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listPicStationDataWzl")
    public TableDataInfo listPicStationDataWzl(DataQualityVO picDataQualityVO) throws ParseException {
        picDataQualityVO.setStatType(8);
        List<DataQualityVO> voList=dataQualityService.listPicStationDataWzl(picDataQualityVO);
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setRows(voList);
        rspData.setMsg("查询成功");
        return rspData;
    }

    /**
     * 显示年月各图片监测站的数据完整率及逐级汇总数据
     */
    @ApiOperation("显示年月各图片监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listPicStationDataWzlGroupYM")
    public AjaxResult listPicStationDataWzlGroupYM(DataQualityVO picDataQualityVOGroupYM) throws ParseException {
        picDataQualityVOGroupYM.setStatType(8);
        List<DataQualityVO> voList=dataQualityService.listPicStationDataWzlGroupYM(picDataQualityVOGroupYM);
        return  AjaxResult.success(voList);
    }

    /**
     * 显示月日各图片监测站的数据完整率及逐级汇总数据
     */
    @ApiOperation("显示月日各图片监测站的数据完整率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listPicStationDataWzlGroupMD")
    public AjaxResult listPicStationDataWzlGroupMD(DataQualityVO picDataQualityVOGroupMD) throws ParseException {
        picDataQualityVOGroupMD.setStatType(8);
        List<DataQualityVO> voList=dataQualityService.listPicStationDataWzlGroupMD(picDataQualityVOGroupMD);
        return  AjaxResult.success(voList);
    }


    /**
     * 显示各监测站的设备报警率及逐级汇总数据
     *
     */
    @ApiOperation("显示各监测站的设备报警率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listEquipmentAlarmBjl")
    public TableDataInfo listEquipmentAlarmBjl(DataQualityVO eqDataQualityVO) throws ParseException {
        eqDataQualityVO.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listEquipmentAlarmBjl(eqDataQualityVO);
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setRows(voList);
        rspData.setMsg("查询成功");
        return rspData;
    }

    /**
     * 显示年月监测站的设备报警率及逐级汇总数据
     */
    @ApiOperation("显示年月监测站的设备报警率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listEquipmentAlarmBjlGroupYM")
    public AjaxResult listEquipmentAlarmBjlGroupYM(DataQualityVO eqDataQualityVOGroupYM) throws ParseException {
        eqDataQualityVOGroupYM.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listEqDataQualityVOGroupYM(eqDataQualityVOGroupYM);
        return  AjaxResult.success(voList);
    }

    /**
     * 显示月日监测站的设备报警率及逐级汇总数据
     */
    @ApiOperation("显示月日监测站的设备报警率及逐级汇总数据")
    @DataScope(organAlias = "wob")
    @GetMapping("/listEquipmentAlarmBjlGroupMD")
    public AjaxResult listEquipmentAlarmBjlGroupMD(DataQualityVO eqDataQualityVOGroupMD) throws ParseException {
        eqDataQualityVOGroupMD.setStatType(2);
        List<DataQualityVO> voList=dataQualityService.listEqDataQualityVOGroupMD(eqDataQualityVOGroupMD);
        return  AjaxResult.success(voList);
    }


}
